package com.clms.rents.controller;

import com.clms.common.R;
import com.clms.rents.pojo.entity.TbCar;
import com.clms.rents.pojo.entity.TbCarType;
import com.clms.rents.pojo.vo.CarTypeVo;
import com.clms.rents.service.CarTypeService;
import jdk.nashorn.internal.runtime.logging.Logger;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @program: clms-third
 * @description: 车的类型
 * @author: 杨浩
 * @create: 2021-07-22 12:16
 **/

@RestController
@RequestMapping("rents/type")
public class CarTypeController {

    @Resource
    private CarTypeService carTypeService;

    @GetMapping("selectall")
    public R selectall(){
        return carTypeService.selectall();
    }//

    @PostMapping("pageSelect/{currentPage}/{pageSize}")
    public R pageSelect(@PathVariable Integer currentPage,
                        @PathVariable Integer pageSize,
                        @RequestBody CarTypeVo carTypeVo){
        return carTypeService.pageSelect(currentPage,pageSize,carTypeVo);
    }
    @PostMapping("insert")
    public R insert(@RequestBody TbCarType tbCarType){
        return carTypeService.insert(tbCarType);
    }

    @GetMapping("selectById/{id}")
    public R selectByid(@PathVariable Integer id){
        return carTypeService.selectById(id);
    }

    @PutMapping("update")
    public R update(@RequestBody TbCarType tbCarType){
        return carTypeService.update(tbCarType);
    }
    @DeleteMapping
    public R delete(@RequestParam Integer id){
        return carTypeService.delete(id);
    }

}
